function hits = alterhitsPerSecond(agi, dex, equipASPD)
	agi += 12; %agi up
	dex += 10; %bless
	dex += 10; %owl eye
	agi = floor(agi *1.12); %improve
	dex = floor(dex*1.12); %improve
	hits = 50/(200 - aspdCalculator(agi, dex, equipASPD));
endfunction

function aspd = aspdCalculator(agi, dex, equipASPD)
%	jobBaseAspd  = 156;
%	ASPDCorrection = roundto((sqrt(205)-sqrt(agi))/7.15, 3);
%	ASPDPotion = 0.15;
%	ASPDSkill = 0; % el blitz beat no tiene delay
%	ASPDPenalty = roundto(1 - ( jobBaseAspd - 144)/50, 2 );
%	if(ASPDPenalty > 0.96)
%		ASPDPenalty = 0.96;
%	endif
%	
%	baseASPD = 200-(200-(jobBaseAspd  - ASPDCorrection + sqrt(agi * 9.999 + dex * 0.19212) * ASPDPenalty)) *(1 - ASPDPotion - ASPDSkill) ;
%	aspd = roundto(baseASPD + equipASPD, 0);
	
	speedMods = 0.15;
	weaponDelay = 60;
%	aspd = (200 - (1-speedMods) * (weaponDelay - (round(weaponDelay*agi/25) + round(weaponDelay*dex/100))/10))
	aspd =  200-(weaponDelay-(round(weaponDelay*agi/25) + round(weaponDelay*dex/100))/10)* (1-speedMods);
%	200-(WD-([WD*AGI/25]+[WD*DEX/100])/10)*(1-SM)
%	aspd = floor(aspd, 0)
endfunction

function result = roundto(num, decimals)
	num =num - mod (num * (10 ^ decimals), 1);
	result = round(num) / 10 ^ decimals;
endfunction